#include <stdint.h>
#include <stdio.h>

// 假设这是STM32F030的GPIO寄存器地址
#define GPIOA_BASE (0x48000000)
#define RCC_BASE (0x40021000)

// 寄存器定义
#define RCC_AHBENR (*(volatile uint32_t *)(RCC_BASE + 0x14))
#define GPIOA_MODER (*(volatile uint32_t *)(GPIOA_BASE + 0x00))
#define GPIOA_BSRR (*(volatile uint32_t *)(GPIOA_BASE + 0x18))

void delay(uint32_t count) {
    while (count--) {
        __asm("nop");
    }
}

int main(void) {
    // 启用GPIOA时钟
    RCC_AHBENR |= (1 << 17);

    // 设置PA5为输出模式
    GPIOA_MODER &= ~(0x3 << (5 * 2));
    GPIOA_MODER |= (0x1 << (5 * 2));
    // printf("helloword");
    while (1) {
        // 点亮LED
        GPIOA_BSRR = (1 << 5);
        delay(1000000);

        // 熄灭LED
        GPIOA_BSRR = (1 << (5 + 16));
        delay(1000000);
    }

    return 0;
}
